//乌鸡国副本
export default {
    "编号": 120,
    "名称": "乌鸡国",
    "任务说明": (task_data) => {
        let characters_id = task_data["characters_id"];
        // 所有副本数据
        let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
        if (dungeon_data === undefined) {
            G.CharactersTask.canel_task(characters_id, 120);
            return;
        }
        // 当前副本数据
        let count = dungeon_data["数量"];
        switch (dungeon_data["进程"]) {
            case 1:
                return ["乌鸡国", `#L降伏所有的木妖（${Math.floor(count / 15 * 100)}%）。剩余时间${Math.floor((task_data["结束时间"] - Date.now() / 1000) / 60)}分钟。`];
            case 2:
                return ["乌鸡国", `#L寻求场景中所有仙人（完成：${Math.floor(count / 15 * 100)}%）。剩余时间${Math.floor((task_data["结束时间"] - Date.now() / 1000) / 60)}分钟。`];
            case 3:
                return ["乌鸡国", `12回合之内消灭三处囚禁仙人的妖怪。剩余时间${Math.floor((task_data["结束时间"] - Date.now() / 1000) / 60)}分钟。`];
            case 4:
                return ["乌鸡国", `#L和#R/qqq|乌鸡国王*6001*临时npc*115*71/乌鸡国王#W对话去皇宫(剩余时间${Math.floor((task_data["结束时间"] - Date.now() / 1000) / 60)}分钟)。`];
            case 5:
                return ["乌鸡国", `#L消灭15个鬼祟小怪，当前已完成（完成：${Math.floor(count / 15 * 100)}%）。剩余时间${Math.floor((task_data["结束时间"] - Date.now() / 1000) / 60)}分钟。`];
            case 6:
                return ["乌鸡国", `#L寻找出真正的乌鸡国王，与真正的国王战斗胜利后本副本将自动结束(剩余时间${Math.floor((task_data["结束时间"] - Date.now() / 1000) / 60)}分钟)`];
            default:
                break;
        }
    },
    "开启副本": (characters_id) => {
        // 指定时间不可以做任务
        if (new Date().getHours() > 23) {
            ClientUtils.send_characters_basic_prompt(characters_id, "#Y/23点后不可做副本任务");
            G.TeamUtils.send_team_message(characters_id, "#Y/23点后不可做副本任务");
            return;
        }
        let characters = _CharactersData.get(characters_id);
        if (characters["队伍"] === 0 || !characters["队长"]) {
            ClientUtils.send_characters_basic_prompt(characters_id, "#Y/该任务必须组队完成且由队长领取");
            return;
        }
        let team_data = G.TeamUtils.get_team_data(characters["队伍"]);
        if (team_data["成员"].length < 5) {
            ClientUtils.send_characters_basic_prompt(characters_id, "#Y此副本要求队伍人数不低于5人");
            G.TeamUtils.send_team_message(characters_id, "#Y此副本要求队伍人数不低于5人");
            return
        }

        if (!G.TeamUtils.check_all_member_level(characters["队伍"], 50)) {
            ClientUtils.send_characters_basic_prompt(characters_id, "#Y此副本要求角色等级不能低于50级");
            G.TeamUtils.send_team_message(characters_id, "#Y此副本要求角色等级不能低于50级");
            return
        }
        // 队员是否正在进行副本任务
        let task_check_res = G.TeamUtils.check_all_member_task(characters["队伍"], 120);
        if (task_check_res) {
            ClientUtils.send_characters_basic_prompt(characters_id, `#Y${task_check_res}正在进行副本任务，无法领取新的副本`);
            G.TeamUtils.send_team_message(characters_id, `#Y${task_check_res}正在进行副本任务，无法领取新的副本`);
            return
        }
        // 队员是否已经完成了副本
        let dungeon_check_res = G.TeamUtils.check_all_member_dungeon_success(characters["队伍"], 120);
        if (dungeon_check_res) {
            ClientUtils.send_characters_basic_prompt(characters_id, `#G${dungeon_check_res}#Y本日已经完成过此副本了`);
            G.TeamUtils.send_team_message(characters_id, `#G${dungeon_check_res}#Y本日已经完成过此副本了`)
            return
        }
        // 超时十分钟内不可重新领取
        let timout_check_res = G.TeamUtils.check_all_member_dungeon_timout(characters["队伍"], 120);
        if (timout_check_res) {
            ClientUtils.send_characters_basic_prompt(characters_id, `#G${timout_check_res[0]}#Y的副本失败冷却中，剩余${timout_check_res[1]}秒`);
            G.TeamUtils.send_team_message(characters_id, `#G${timout_check_res[0]}#Y的副本失败冷却中，剩余${timout_check_res[1]}秒`)
            return
        }
        let task_data = {
            "开始时间": Math.floor(Date.now() / 1000),
            "结束时间": Math.floor(Date.now() / 1000) + (60 * 60),
            "超时取消": true,
            "副本": 120,
        };
        // 为所有队员添加任务
        G.TeamUtils.add_dungeon_task(characters["队伍"], 120, task_data, "#Y你开启了乌鸡国副本");
        G.TeamUtils.send_team_message(characters_id, `#Y乌鸡国副本已开启，可以进入副本。`)
    },
    "进入副本": (characters_id) => {
        if (!G.CharactersTask.get_task_by_number(characters_id, 120)) {
            ClientUtils.send_characters_basic_prompt(characters_id, "#Y/你尚未开启此副本");
            return;
        }
        let characters = _CharactersData.get(characters_id);
        //当前副本数据
        let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
        let map_id = 6001;
        let x = 112;
        let y = 14;
        if (dungeon_data["进程"] > 4) {
            map_id = 6002;
            x = 29;
            y = 56;
        }
        // 移动至副本地图
        G.MapUtils.move_characters_to_map(characters, map_id, x, y);
        //刷新副本进程
        refrush_dungeon(characters_id);
    },
    "刷新副本": (characters_id) => {
        refrush_dungeon(characters_id)
    },
    "对话": {
        6001: {
            "芭蕉木妖": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "木妖",
                    "芭蕉木妖",
                    "你是谁？离这里远一点。",
                    ["哼，少废话，看打！"]
                ];
            },
            "热心仙人": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "热心仙人",
                    "热心仙人",
                    "少侠辛苦了,这是你的奖励",
                    ["领取奖励"]
                ];
            },
            "囚神妖怪": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "地狱战神",
                    "囚神妖怪",
                    "你是谁？离这里远一点。",
                    ["哼，少废话，看打！", "我这就走，这就走"]
                ];
            },
            "拘灵妖怪": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "地狱战神",
                    "拘灵妖怪",
                    "你是谁？离这里远一点。",
                    ["哼，少废话，看打！", "我这就走，这就走"]
                ];
            },
            "缚仙妖怪": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "地狱战神",
                    "缚仙妖怪",
                    "你是谁？离这里远一点。",
                    ["哼，少废话，看打！", "我这就走，这就走"]
                ];
            },
            "乌鸡国王": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "文伯",
                    "乌鸡国王",
                    "那妖怪正在皇宫内冒充我作恶，还请少侠赶紧进去揭露事情真相。",
                    ["送我进去", "我再想想"]
                ];
            },
        },
        6002: {
            "鬼祟小怪": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "兔子怪",
                    "鬼祟小怪",
                    "你是谁？离这里远一点。",
                    ["哼，少废话，看打！", "我这就走，这就走"]
                ];
            },
            "乌鸡国王": (characters, npc_data) => {
                // 保存最后对话npc数据
                _LastDialogueData.set(characters["id"], npc_data);
                return [
                    "文伯",
                    "乌鸡国王",
                    "你确定他是假冒的乌鸡国王吗？（如果选择正确只需要完成一场战斗，如果误伤好人则还需要继续挑战假冒国王）。",
                    ["假冒国王就是他！", "我再想想"]
                ];
            },
        }
    },
    "对话处理": {
        6001: {
            "芭蕉木妖": {
                "哼，少废话，看打！": (characters_id) => {
                    if (_LastDialogueData.has(characters_id) && _LastDialogueData.get(characters_id)["名称"] === "芭蕉木妖") {
                        G.FightUtils.create_monster_fight(characters_id, 100028, "120-1");
                    }
                }
            },
            "热心仙人": {
                "领取奖励": (characters_id) => {
                    G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                        let team_characters = _CharactersData.get(team_characters_id);
                        if (team_characters) {
                            let level = team_characters["等级"];
                            G.Characters.add_exp(team_characters_id, level * G.RandomUtils.generate_random(1350, 1550));
                            G.Characters.add_number_field_value(team_characters_id, "银子", level * G.RandomUtils.generate_random(90, 120) + 16000);
                            // 当前副本数据
                            let dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                            dungeon_data["数量"] += 1;
                            // 刷新任务
                            G.CharactersTask.refrush_task(team_characters_id);
                        }
                    });
                    // 从地图中移除NPC
                    let npc_number = _LastDialogueData.get(characters_id)["编号"];
                    let map_id = npc_number.split("_")[0];
                    G.MapUtils.remove_map_npc(Number(map_id), npc_number);
                    // 刷新副本数据
                    refrush_dungeon(characters_id);
                }
            },
            "囚神妖怪": {
                "哼，少废话，看打！": (characters_id) => {
                    if (_LastDialogueData.has(characters_id) && _LastDialogueData.get(characters_id)["名称"] === "囚神妖怪") {
                        G.FightUtils.create_monster_fight(characters_id, 100029, "120-3");
                    }
                },
                "我这就走，这就走": (characters_id) => {
                },
            },
            "拘灵妖怪": {
                "哼，少废话，看打！": (characters_id) => {
                    if (_LastDialogueData.has(characters_id) && _LastDialogueData.get(characters_id)["名称"] === "拘灵妖怪") {
                        G.FightUtils.create_monster_fight(characters_id, 100029, "120-3");
                    }
                },
                "我这就走，这就走": (characters_id) => {
                },
            },
            "缚仙妖怪": {
                "哼，少废话，看打！": (characters_id) => {
                    if (_LastDialogueData.has(characters_id) && _LastDialogueData.get(characters_id)["名称"] === "缚仙妖怪") {
                        G.FightUtils.create_monster_fight(characters_id, 100029, "120-3");
                    }
                },
                "我这就走，这就走": (characters_id) => {
                },
            },
            "乌鸡国王": {
                "送我进去": (characters_id) => {
                    let characters = _CharactersData.get(characters_id);
                    // 移动至新副本地图
                    G.MapUtils.move_characters_to_map(characters, 6002, 26, 58);
                    //刷新副本进程
                    let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
                    dungeon_data["进程"] = 5;
                    dungeon_data["进程开启"] = false;
                    refrush_dungeon(characters_id);
                },
            },
        },
        6002: {
            "鬼祟小怪": {
                "哼，少废话，看打！": (characters_id) => {
                    if (_LastDialogueData.has(characters_id) && _LastDialogueData.get(characters_id)["名称"] === "鬼祟小怪") {
                        G.FightUtils.create_monster_fight(characters_id, 100030, "120-5");
                    }
                },
                "我这就走，这就走": (characters_id) => {
                },
            },
            "乌鸡国王": {
                "假冒国王就是他！": (characters_id) => {
                    if (_LastDialogueData.has(characters_id) && _LastDialogueData.get(characters_id)["名称"] === "乌鸡国王") {
                        G.FightUtils.create_monster_fight(characters_id, 100031, "120-6");
                    }
                },
            },
        }
    },
    "战斗结算": {
        "120-1": {
            "胜利队伍": (fight_data, win_team_index, fail_team_index) => {
                if (win_team_index === 0) {
                    G.FightSettlementUtils.win_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                        //当前副本数据
                        let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
                        dungeon_data["数量"] += 1;
                        // 掉落
                        _DropsItemsData.get(1)(characters_id);
                        // 刷新任务
                        G.CharactersTask.refrush_task(characters_id);
                    });
                    // 从地图中移除战败NPC 在战斗结算完成后通知客户端删除
                    let npc_number = _LastDialogueData.get(fight_data["id"])["编号"];
                    let map_id = npc_number.split("_")[0];
                    G.MapUtils.remove_map_npc(Number(map_id), npc_number);
                    // 刷新副本数据
                    refrush_dungeon(fight_data["id"]);
                }
            },
            "失败队伍": (fight_data, win_team_index, fail_team_index) => {
                G.FightSettlementUtils.fail_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                    G.Characters.remove_number_field_value(characters_id, "银子", Math.floor(characters["银子"] * 0.085));
                    G.Characters.remove_exp(characters_id, Math.floor(characters["经验"] * 0.085))
                });
            }
        },
        "120-3": {
            "胜利队伍": (fight_data, win_team_index, fail_team_index) => {
                if (win_team_index === 0) {
                    G.FightSettlementUtils.win_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                        //当前副本数据
                        let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
                        dungeon_data[_LastDialogueData.get(fight_data["id"])["名称"]] = true;
                        // 掉落
                        _DropsItemsData.get(2)(characters_id);
                        // 刷新任务
                        G.CharactersTask.refrush_task(characters_id);
                    });
                    // 从地图中移除战败NPC 在战斗结算完成后通知客户端删除
                    let npc_number = _LastDialogueData.get(fight_data["id"])["编号"];
                    let map_id = npc_number.split("_")[0];
                    G.MapUtils.remove_map_npc(Number(map_id), npc_number);
                    // 刷新副本数据
                    refrush_dungeon(fight_data["id"]);
                }
            },
            "失败队伍": (fight_data, win_team_index, fail_team_index) => {
                G.FightSettlementUtils.fail_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                    G.Characters.remove_number_field_value(characters_id, "银子", Math.floor(characters["银子"] * 0.085));
                    G.Characters.remove_exp(characters_id, Math.floor(characters["经验"] * 0.085))
                });
            }
        },
        "120-5": {
            "胜利队伍": (fight_data, win_team_index, fail_team_index) => {
                if (win_team_index === 0) {
                    G.FightSettlementUtils.win_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                        //当前副本数据
                        let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
                        dungeon_data["数量"] += 1;
                        // 掉落
                        _DropsItemsData.get(3)(characters_id);
                        // 刷新任务
                        G.CharactersTask.refrush_task(characters_id);
                    });
                    // 从地图中移除战败NPC 在战斗结算完成后通知客户端删除
                    let npc_number = _LastDialogueData.get(fight_data["id"])["编号"];
                    let map_id = npc_number.split("_")[0];
                    G.MapUtils.remove_map_npc(Number(map_id), npc_number);
                    // 刷新副本数据
                    refrush_dungeon(fight_data["id"]);
                }
            },
            "失败队伍": (fight_data, win_team_index, fail_team_index) => {
                G.FightSettlementUtils.fail_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                    G.Characters.remove_number_field_value(characters_id, "银子", Math.floor(characters["银子"] * 0.085));
                    G.Characters.remove_exp(characters_id, Math.floor(characters["经验"] * 0.085))
                });
            }
        },
        "120-6": {
            "胜利队伍": (fight_data, win_team_index, fail_team_index) => {
                if (win_team_index === 0) {

                    // TODO  let link_text = { "提示": `#S(乌鸡国副本)#R/${characters["名称"]}#R很好的表现了自己的实力，乌鸡国王送他一个`, "频道": "xt", "结尾": "#R！#50" };
                    // TODO 玩家数据[stid].道具:给予超链接书铁(stid,{15,15},nil,链接)
                    G.FightSettlementUtils.win_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                        if (!_LastDialogueData.get(fight_data["id"])["真假"]) {
                            //当前副本数据
                            let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
                            dungeon_data["完成"] = true;
                            // 掉落
                            _DropsItemsData.get(3)(characters_id);
                            // 通知完成
                            G.ChatUtils.send_character_system_chat(characters_id, "#G已完成乌鸡国副本");
                            // 取消任务
                            G.CharactersTask.canel_task(characters_id, 120);
                        }
                    });
                    // 从地图中移除战败NPC 在战斗结算完成后通知客户端删除
                    let npc_number = _LastDialogueData.get(fight_data["id"])["编号"];
                    let map_id = npc_number.split("_")[0];
                    G.MapUtils.remove_map_npc(Number(map_id), npc_number);
                }
            },
            "失败队伍": (fight_data, win_team_index, fail_team_index) => {
                G.FightSettlementUtils.fail_team_settlement_callback(fight_data, win_team_index, fail_team_index, (characters_id, characters) => {
                    G.Characters.remove_number_field_value(characters_id, "银子", Math.floor(characters["银子"] * 0.085));
                    G.Characters.remove_exp(characters_id, Math.floor(characters["经验"] * 0.085))
                });
            }
        },
    },
    "超时处理": (task_data) => {
        let characters_id = task_data["characters_id"];
        let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
        if (dungeon_data) {
            dungeon_data["超时"] = Math.floor(Date.now() / 1000);
            // 通知副本超时
            ClientUtils.send_characters_basic_prompt(characters_id, "#R乌鸡国副本已超时。");
        }
    },
}

// 副本进程
export const process_data = {
    1: (characters_id, dungeon_data) => {
        if (!dungeon_data["进程开启"]) {
            let npc_data = {
                "名称": "芭蕉木妖",
                "模型": "树怪",
                "类型": "副本NPC",
                "变异": false,
            }
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6001, 1131, npc_data, 15);
            // 更新副本状态
            G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                let team_characters_dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                team_characters_dungeon_data["进程"] = 1;
                team_characters_dungeon_data["地图"] = 6001;
                team_characters_dungeon_data["数量"] = 0;
                team_characters_dungeon_data["进程开启"] = true;
                // 更新任务时间
                let task_data = G.CharactersTask.get_task_by_number(characters_id, 120);
                task_data["开始时间"] = Math.floor(Date.now() / 1000);
                task_data["结束时间"] = Math.floor(Date.now() / 1000) + (60 * 60);
                // 刷新任务
                G.CharactersTask.refrush_task(team_characters_id);
            });

        } else {
            // 同步副本地图NPC数据
            G.MapUtils.sync_team_dungeon_npc(characters_id, 120, 6001);
        }
        // 是否进入下一进程
        if (dungeon_data["数量"] === 15) {
            dungeon_data["进程"] = 2;
            dungeon_data["进程开启"] = false;
            refrush_dungeon(characters_id);
        }
    },
    2: (characters_id, dungeon_data) => {
        if (!dungeon_data["进程开启"]) {
            dungeon_data["地图"] = 6001;
            let npc_data = {
                "名称": "热心仙人",
                "模型": "热心仙人",
                "类型": "副本NPC",
                "变异": false,
            }
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6001, 1131, npc_data, 15);
            // 更新副本状态
            G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                let team_characters_dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                team_characters_dungeon_data["进程"] = 2;
                team_characters_dungeon_data["地图"] = 6001;
                team_characters_dungeon_data["进程开启"] = true;
                team_characters_dungeon_data["数量"] = 0;
                // 更新任务时间
                let task_data = G.CharactersTask.get_task_by_number(characters_id, 120);
                task_data["开始时间"] = Math.floor(Date.now() / 1000);
                task_data["结束时间"] = Math.floor(Date.now() / 1000) + (60 * 60);
                // 刷新任务
                G.CharactersTask.refrush_task(team_characters_id);
            });
        } else {
            // 同步副本地图NPC数据
            G.MapUtils.sync_team_dungeon_npc(characters_id, 120, 6001);
        }
        // 是否进入下一进程
        if (dungeon_data["数量"] === 15) {
            dungeon_data["进程"] = 3;
            dungeon_data["进程开启"] = false;
            refrush_dungeon(characters_id);
        }
    },
    3: (characters_id, dungeon_data) => {
        if (!dungeon_data["进程开启"]) {
            // 向副本地图内添加NPC
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6001, 1131, {
                "名称": "囚神妖怪",
                "模型": "地狱战神",
                "类型": "副本NPC",
                "变异": false,
            }, 1);
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6001, 1131, {
                "名称": "拘灵妖怪",
                "模型": "地狱战神",
                "类型": "副本NPC",
                "变异": false,
            }, 1);
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6001, 1131, {
                "名称": "缚仙妖怪",
                "模型": "地狱战神",
                "类型": "副本NPC",
                "变异": false,
            }, 1);
            // 更新副本状态
            G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                let team_characters_dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                team_characters_dungeon_data["进程"] = 3;
                team_characters_dungeon_data["地图"] = 6001;
                team_characters_dungeon_data["进程开启"] = true;
                team_characters_dungeon_data["囚神妖怪"] = false;
                team_characters_dungeon_data["拘灵妖怪"] = false;
                team_characters_dungeon_data["缚仙妖怪"] = false;
                // 更新任务时间
                let task_data = G.CharactersTask.get_task_by_number(characters_id, 120);
                task_data["开始时间"] = Math.floor(Date.now() / 1000);
                task_data["结束时间"] = Math.floor(Date.now() / 1000) + (60 * 60);
                // 刷新任务
                G.CharactersTask.refrush_task(team_characters_id);
            });
        } else {
            // 同步副本地图NPC数据
            G.MapUtils.sync_team_dungeon_npc(characters_id, 120, 6001);
        }
        // 是否进入下一进程
        if (dungeon_data["囚神妖怪"] && dungeon_data["拘灵妖怪"] && dungeon_data["缚仙妖怪"]) {
            dungeon_data["进程"] = 4;
            dungeon_data["进程开启"] = false;
            refrush_dungeon(characters_id);
        }
    },
    4: (characters_id, dungeon_data) => {
        if (!dungeon_data["进程开启"]) {
            // 向副本地图内添加NPC
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6001, null, {
                "名称": "乌鸡国王",
                "模型": "文伯",
                "类型": "副本NPC",
                "变异": false,
                "x": 115,
                "y": 71,
            }, 1);
            // 更新副本状态
            G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                let team_characters_dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                team_characters_dungeon_data["进程"] = 4;
                team_characters_dungeon_data["地图"] = 6001;
                team_characters_dungeon_data["进程开启"] = true;
                // 更新任务时间
                let task_data = G.CharactersTask.get_task_by_number(characters_id, 120);
                task_data["开始时间"] = Math.floor(Date.now() / 1000);
                task_data["结束时间"] = Math.floor(Date.now() / 1000) + (60 * 60);
                // 刷新任务
                G.CharactersTask.refrush_task(team_characters_id);
            });
        } else {
            // 同步副本地图NPC数据
            G.MapUtils.sync_team_dungeon_npc(characters_id, 120, 6001);
        }
    },
    5: (characters_id, dungeon_data) => {
        if (!dungeon_data["进程开启"]) {
            let npc_data = {
                "名称": "鬼祟小怪",
                "模型": "兔子怪",
                "类型": "副本NPC",
                "变异": false,
            }
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6002, 1131, npc_data, 15);
            // 更新副本状态
            G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                let team_characters_dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                team_characters_dungeon_data["进程"] = 5;
                team_characters_dungeon_data["地图"] = 6002;
                team_characters_dungeon_data["数量"] = 0;
                team_characters_dungeon_data["进程开启"] = true;
                // 更新任务时间
                let task_data = G.CharactersTask.get_task_by_number(characters_id, 120);
                task_data["开始时间"] = Math.floor(Date.now() / 1000);
                task_data["结束时间"] = Math.floor(Date.now() / 1000) + (60 * 60);
                // 刷新任务
                G.CharactersTask.refrush_task(team_characters_id);
            });
        } else {
            // 同步副本地图NPC数据
            G.MapUtils.sync_team_dungeon_npc(characters_id, 120, 6002);
        }
        // 是否进入下一进程
        if (dungeon_data["数量"] === 15) {
            dungeon_data["进程"] = 6;
            dungeon_data["进程开启"] = false;
            refrush_dungeon(characters_id);
        }
    },
    6: (characters_id, dungeon_data) => {
        if (!dungeon_data["进程开启"]) {
            let values = [false, false];
            let random_index = G.RandomUtils.random_get_array([0, 1]);
            values[random_index] = true;
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6002, null, {
                "名称": "乌鸡国王",
                "模型": "文伯",
                "类型": "副本NPC",
                "变异": false,
                "x": 50,
                "y": 47,
                "真假": values[0],
            }, 1);
            G.MapUtils.batch_add_team_dungeon_npc(characters_id, 120, 6002, null, {
                "名称": "乌鸡国王",
                "模型": "文伯",
                "类型": "副本NPC",
                "变异": false,
                "x": 59,
                "y": 42,
                "真假": values[1],
            }, 1);
            // 更新副本状态
            G.TeamUtils.team_member_callback(characters_id, (index, team_characters_id, args) => {
                let team_characters_dungeon_data = G.DungeonUtils.get_dungeon_data(team_characters_id, "120");
                team_characters_dungeon_data["进程"] = 6;
                team_characters_dungeon_data["地图"] = 6002;
                team_characters_dungeon_data["进程开启"] = true;
                // 更新任务时间
                let task_data = G.CharactersTask.get_task_by_number(characters_id, 120);
                task_data["开始时间"] = Math.floor(Date.now() / 1000);
                task_data["结束时间"] = Math.floor(Date.now() / 1000) + (60 * 60);
                // 刷新任务
                G.CharactersTask.refrush_task(team_characters_id);
            });
        } else {
            // 同步副本地图NPC数据
            G.MapUtils.sync_team_dungeon_npc(characters_id, 120, 6002);
        }
    }
}

/**
 * 刷新副本
 * @param {*} characters_id 
 */
function refrush_dungeon(characters_id) {
    // 当前副本数据
    let dungeon_data = G.DungeonUtils.get_dungeon_data(characters_id, "120");
    process_data[dungeon_data["进程"]](characters_id, dungeon_data);
}